package com.ibeeking.found.msg.rest.controller.v1;


import com.ibeeking.found.common.annotation.LoginUser;
import com.ibeeking.found.common.entity.CurrentUser;
import com.ibeeking.found.msg.rest.service.IWxMpGroupMessageService;
import com.ibeeking.found.msg.service.common.param.WxMpGroupMessageParam;
import com.ibeeking.found.msg.service.common.param.WxMpGroupMessageUploadParam;
import com.ibeeking.found.msg.service.common.query.WxMpGroupMessagePageQuery;
import com.ibeeking.found.msg.service.common.vo.WxMpGroupMessagePageVO;
import com.ibeeking.found.msg.service.common.vo.WxMpGroupMessageUploadVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import com.ibeeking.nematos.utils.base.BaseValidationGroup;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 群发消息接口
 * @ClassName WxmpGroupMessageController控制器
 * @Description
 * @Author ibeeking
 * @Date 2020-12-25 11:20
 **/
@RestController
@RequestMapping("/b/wxMp/groupMsg/v1")
public class WxMpGroupMessageController {

    @Resource
    private IWxMpGroupMessageService wxMpGroupMessageServiceImpl;



    @Log(logType = OperateLogTypeEnum.QUERY, describe = "消息推送分页")
    @PostMapping(value = "/pageList")
    public IPage<WxMpGroupMessagePageVO> pageList(@RequestBody WxMpGroupMessagePageQuery pageQuery) {
        return wxMpGroupMessageServiceImpl.pageList(pageQuery);
    }

    @Log(logType = OperateLogTypeEnum.SAVE, describe = "提交保存消息发送")
    @PostMapping(value = "/add")
    public Boolean add(@RequestBody @Validated(BaseValidationGroup.Insert.class) WxMpGroupMessageUploadParam param) {

        return wxMpGroupMessageServiceImpl.add(param);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "修改发送内容")
    @PostMapping(value = "/modify")
    @Deprecated
    public Boolean modify(@RequestBody @Validated(BaseValidationGroup.Update.class) WxMpGroupMessageParam param) {
        return wxMpGroupMessageServiceImpl.modify(param);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询详情")
    @GetMapping(value = "/view/{id}")
    public WxMpGroupMessageUploadVO view(@PathVariable("id") Long id) {
        return wxMpGroupMessageServiceImpl.view(id);
    }


    @Log(logType = OperateLogTypeEnum.DEL, describe = "删除推送记录")
    @GetMapping(value = "/del/{id}")
    public Boolean del(@PathVariable("id") Long id) {
        return wxMpGroupMessageServiceImpl.del(id);
    }




}
